import request from '@/utils/request'

//获取菜品详情接口
export const getDishDetailAPI = (id) => {
  return request({
    url: `/user/dish/getDetail`,
    method: 'GET',
    data:{
      id
    }
  })
}

//获取用户评分接口
export const getDishScoreAPI = (userId, dishId) => {
  return request({
    url: `/user/dish/rate`,
    method: 'GET',
    data: {
      userId,
      dishId
    }
  })
}

//提交评分接口
export const submitDishScoreAPI = (userId, dishId, score) => {
  return request({
    url: `/user/dish/rate?userId=${userId}&dishId=${dishId}&score=${score}`,
    method: 'POST',
  })
}

//添加收藏菜品接口
export const addToCollectionAPI = (id) => {
  return request({
    url: `/dish/collect`,
    method: 'POST',
    data: {
      id
    }
  })
}

//移出收藏菜品接口
export const removeFromCollectionAPI = (id) => {
  return request({
    url: `/dish/uncollect`,
    method: 'POST',
    data: {
      id
    }
  })
}
